<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>IgH EtherCAT Master: device.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">IgH EtherCAT Master
   &#160;<span id="projectnumber">1.5.2</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('device_8h.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">device.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>EtherCAT device structure.  
<a href="#details">More...</a></p>

<p><a href="device_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structec__device.html">ec_device</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">EtherCAT device.  <a href="structec__device.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a8e81effb90ab4150ac1fe4114e7775f0"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="device_8h.html#a8e81effb90ab4150ac1fe4114e7775f0">EC_TX_RING_SIZE</a>&#160;&#160;&#160;2</td></tr>
<tr class="memdesc:a8e81effb90ab4150ac1fe4114e7775f0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Size of the transmit ring.  <a href="#a8e81effb90ab4150ac1fe4114e7775f0">More...</a><br /></td></tr>
<tr class="separator:a8e81effb90ab4150ac1fe4114e7775f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a02288d2a8148ced6479c1285f9dc2bd1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="device_8h.html#a02288d2a8148ced6479c1285f9dc2bd1">ec_device_init</a> (<a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *, <a class="el" href="group__ApplicationInterface.html#ga60ec31b46fcf7994c511359402c64baa">ec_master_t</a> *)</td></tr>
<tr class="memdesc:a02288d2a8148ced6479c1285f9dc2bd1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="#a02288d2a8148ced6479c1285f9dc2bd1">More...</a><br /></td></tr>
<tr class="separator:a02288d2a8148ced6479c1285f9dc2bd1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3099aa0e5bfa03897b85f4b542108d87"><td class="memItemLeft" align="right" valign="top"><a id="a3099aa0e5bfa03897b85f4b542108d87"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="device_8h.html#a3099aa0e5bfa03897b85f4b542108d87">ec_device_clear</a> (<a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *)</td></tr>
<tr class="memdesc:a3099aa0e5bfa03897b85f4b542108d87"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <br /></td></tr>
<tr class="separator:a3099aa0e5bfa03897b85f4b542108d87"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7f14ad3873acec6c4aab27a403b86e2f"><td class="memItemLeft" align="right" valign="top"><a id="a7f14ad3873acec6c4aab27a403b86e2f"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="device_8h.html#a7f14ad3873acec6c4aab27a403b86e2f">ec_device_attach</a> (<a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *, struct net_device *, <a class="el" href="ecdev_8h.html#a789bcd88d869f88c58bd13b451b3fd52">ec_pollfunc_t</a>, struct module *)</td></tr>
<tr class="memdesc:a7f14ad3873acec6c4aab27a403b86e2f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Associate with net_device. <br /></td></tr>
<tr class="separator:a7f14ad3873acec6c4aab27a403b86e2f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6aa86617de7ed991048e151847683a01"><td class="memItemLeft" align="right" valign="top"><a id="a6aa86617de7ed991048e151847683a01"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="device_8h.html#a6aa86617de7ed991048e151847683a01">ec_device_detach</a> (<a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *)</td></tr>
<tr class="memdesc:a6aa86617de7ed991048e151847683a01"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disconnect from net_device. <br /></td></tr>
<tr class="separator:a6aa86617de7ed991048e151847683a01"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abddc8be76e9422963c7814777bf80525"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="device_8h.html#abddc8be76e9422963c7814777bf80525">ec_device_open</a> (<a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *)</td></tr>
<tr class="memdesc:abddc8be76e9422963c7814777bf80525"><td class="mdescLeft">&#160;</td><td class="mdescRight">Opens the EtherCAT device.  <a href="#abddc8be76e9422963c7814777bf80525">More...</a><br /></td></tr>
<tr class="separator:abddc8be76e9422963c7814777bf80525"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afb0366cde94e727915b7bc0edd82e9d4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="device_8h.html#afb0366cde94e727915b7bc0edd82e9d4">ec_device_close</a> (<a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *)</td></tr>
<tr class="memdesc:afb0366cde94e727915b7bc0edd82e9d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stops the EtherCAT device.  <a href="#afb0366cde94e727915b7bc0edd82e9d4">More...</a><br /></td></tr>
<tr class="separator:afb0366cde94e727915b7bc0edd82e9d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae9ba13e6b8f14f6633250f176e82bec2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="device_8h.html#ae9ba13e6b8f14f6633250f176e82bec2">ec_device_poll</a> (<a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *)</td></tr>
<tr class="memdesc:ae9ba13e6b8f14f6633250f176e82bec2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calls the poll function of the assigned net_device.  <a href="#ae9ba13e6b8f14f6633250f176e82bec2">More...</a><br /></td></tr>
<tr class="separator:ae9ba13e6b8f14f6633250f176e82bec2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5f9614c819d9e94aaea708f3351e2826"><td class="memItemLeft" align="right" valign="top">uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="device_8h.html#a5f9614c819d9e94aaea708f3351e2826">ec_device_tx_data</a> (<a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *)</td></tr>
<tr class="memdesc:a5f9614c819d9e94aaea708f3351e2826"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a pointer to the device's transmit memory.  <a href="#a5f9614c819d9e94aaea708f3351e2826">More...</a><br /></td></tr>
<tr class="separator:a5f9614c819d9e94aaea708f3351e2826"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acbce72d98a923245aca830dd82d2b36f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="device_8h.html#acbce72d98a923245aca830dd82d2b36f">ec_device_send</a> (<a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *, size_t)</td></tr>
<tr class="memdesc:acbce72d98a923245aca830dd82d2b36f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends the content of the transmit socket buffer.  <a href="#acbce72d98a923245aca830dd82d2b36f">More...</a><br /></td></tr>
<tr class="separator:acbce72d98a923245aca830dd82d2b36f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2889ce889e3a481040666349d4220829"><td class="memItemLeft" align="right" valign="top"><a id="a2889ce889e3a481040666349d4220829"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="device_8h.html#a2889ce889e3a481040666349d4220829">ec_device_clear_stats</a> (<a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *)</td></tr>
<tr class="memdesc:a2889ce889e3a481040666349d4220829"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears the frame statistics. <br /></td></tr>
<tr class="separator:a2889ce889e3a481040666349d4220829"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a487e82c3004aafd09d2a2b993960ee60"><td class="memItemLeft" align="right" valign="top"><a id="a487e82c3004aafd09d2a2b993960ee60"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="device_8h.html#a487e82c3004aafd09d2a2b993960ee60">ec_device_update_stats</a> (<a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *)</td></tr>
<tr class="memdesc:a487e82c3004aafd09d2a2b993960ee60"><td class="mdescLeft">&#160;</td><td class="mdescRight">Update device statistics. <br /></td></tr>
<tr class="separator:a487e82c3004aafd09d2a2b993960ee60"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>EtherCAT device structure. </p>

<p class="definition">Definition in file <a class="el" href="device_8h_source.html">device.h</a>.</p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a8e81effb90ab4150ac1fe4114e7775f0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8e81effb90ab4150ac1fe4114e7775f0">&#9670;&nbsp;</a></span>EC_TX_RING_SIZE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define EC_TX_RING_SIZE&#160;&#160;&#160;2</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Size of the transmit ring. </p>
<p>This memory ring is used to transmit frames. It is necessary to use different memory regions, because otherwise the network device DMA could send the same data twice, if it is called twice. </p>

<p class="definition">Definition at line <a class="el" href="device_8h_source.html#l00051">51</a> of file <a class="el" href="device_8h_source.html">device.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a02288d2a8148ced6479c1285f9dc2bd1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a02288d2a8148ced6479c1285f9dc2bd1">&#9670;&nbsp;</a></span>ec_device_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ec_device_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *&#160;</td>
          <td class="paramname"><em>device</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__ApplicationInterface.html#ga60ec31b46fcf7994c511359402c64baa">ec_master_t</a> *&#160;</td>
          <td class="paramname"><em>master</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructor. </p>
<dl class="section return"><dt>Returns</dt><dd>0 in case of success, else &lt; 0 </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">device</td><td>EtherCAT device </td></tr>
    <tr><td class="paramname">master</td><td>master owning the device </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="device_8c_source.html#l00063">63</a> of file <a class="el" href="device_8c_source.html">device.c</a>.</p>

</div>
</div>
<a id="abddc8be76e9422963c7814777bf80525"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abddc8be76e9422963c7814777bf80525">&#9670;&nbsp;</a></span>ec_device_open()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ec_device_open </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *&#160;</td>
          <td class="paramname"><em>device</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Opens the EtherCAT device. </p>
<dl class="section return"><dt>Returns</dt><dd>0 in case of success, else &lt; 0 </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">device</td><td>EtherCAT device </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="device_8c_source.html#l00242">242</a> of file <a class="el" href="device_8c_source.html">device.c</a>.</p>

</div>
</div>
<a id="afb0366cde94e727915b7bc0edd82e9d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afb0366cde94e727915b7bc0edd82e9d4">&#9670;&nbsp;</a></span>ec_device_close()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ec_device_close </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *&#160;</td>
          <td class="paramname"><em>device</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Stops the EtherCAT device. </p>
<dl class="section return"><dt>Returns</dt><dd>0 in case of success, else &lt; 0 </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">device</td><td>EtherCAT device </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="device_8c_source.html#l00279">279</a> of file <a class="el" href="device_8c_source.html">device.c</a>.</p>

</div>
</div>
<a id="ae9ba13e6b8f14f6633250f176e82bec2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae9ba13e6b8f14f6633250f176e82bec2">&#9670;&nbsp;</a></span>ec_device_poll()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ec_device_poll </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *&#160;</td>
          <td class="paramname"><em>device</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calls the poll function of the assigned net_device. </p>
<p>The master itself works without using interrupts. Therefore the processing of received data and status changes of the network device has to be done by the master calling the ISR "manually". </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">device</td><td>EtherCAT device </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="device_8c_source.html#l00478">478</a> of file <a class="el" href="device_8c_source.html">device.c</a>.</p>

</div>
</div>
<a id="a5f9614c819d9e94aaea708f3351e2826"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5f9614c819d9e94aaea708f3351e2826">&#9670;&nbsp;</a></span>ec_device_tx_data()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t* ec_device_tx_data </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *&#160;</td>
          <td class="paramname"><em>device</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns a pointer to the device's transmit memory. </p>
<dl class="section return"><dt>Returns</dt><dd>pointer to the TX socket buffer </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">device</td><td>EtherCAT device </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="device_8c_source.html#l00312">312</a> of file <a class="el" href="device_8c_source.html">device.c</a>.</p>

</div>
</div>
<a id="acbce72d98a923245aca830dd82d2b36f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acbce72d98a923245aca830dd82d2b36f">&#9670;&nbsp;</a></span>ec_device_send()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ec_device_send </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="ecdev_8h.html#ac0895793ea540357d225d4b8be71f2e4">ec_device_t</a> *&#160;</td>
          <td class="paramname"><em>device</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sends the content of the transmit socket buffer. </p>
<p>Cuts the socket buffer content to the (now known) size, and calls the start_xmit() function of the assigned net_device. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">device</td><td>EtherCAT device </td></tr>
    <tr><td class="paramname">size</td><td>number of bytes to send </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="device_8c_source.html#l00331">331</a> of file <a class="el" href="device_8c_source.html">device.c</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_c1346cf4828efdd0d2baf0d391d01b77.html">master</a></li><li class="navelem"><a class="el" href="device_8h.html">device.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
